﻿using System;
using Pantry.DataAccess;
using Pantry.Entity;

[assembly: CLSCompliant(true)]
namespace Pantry.Business
{
    public class AccountBus
    {
        private AccountDao _accountDao;

        /// <summary>
        /// Logs the on.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns></returns>
        public bool LogOn(User user)
        {
            _accountDao = new AccountDao();
            int result = _accountDao.LogOn(user);
            return (result != 0);
        }


        /// <summary>
        /// Changes the password.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns></returns>
        public bool ChangePassword(User user)
        {
            _accountDao = new AccountDao();
            int result = _accountDao.ChangePassword(user);
            return (result != 0);
        }

        /// <summary>
        /// Gets the role.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns></returns>
        public int GetRole(User user)
        {
            _accountDao = new AccountDao();
            return _accountDao.GetRole(user);
        }
    }
}
